<template>
	<view class="">
		<view class="list_row" >
			<view class="list_top" @click="onShop(row)">
				<view class="list_top_left">
					<view class="image">
						<image :src="row.avatar" mode="scaleToFill" ></image>
					</view>
					<view class="info">
						<view>
							{{row.name}}
						</view>
						<view class="" v-if="row.year_num != '' ">
							<text v-if="row.type == 1">{{row.year_num}}  {{row.like+row.collect+row.transmit}}人想找他施工</text>
							<text v-if="row.type == 2">{{row.year_num}}  {{row.like+row.collect+row.transmit}}人想找他设计</text>
							<text v-if="row.type == 3">{{row.year_num}}  {{row.like+row.collect+row.transmit}}人进店咨询</text>
						</view>
						<view class="" v-else>
							<image src="http://tuzhuang-1304727035.file.myqcloud.com/20211213/9xzzpO1JjprRBWoMe8im4hNqw44eyw0lYiQ4tjX2.png"  mode="" v-if="row.is_like == 1"></image>
							<image src="http://tuzhuang-1304727035.file.myqcloud.com/20211213/2Z7ZCcSdj0pqOvT0fV0V0oFoyQrG5lWBzpZshjch.png" mode="" v-else></image>
							<text>{{row.like}}</text>
						</view>
					</view>
				</view>
				<view class="list_top_right" >
					进店
				</view>
			</view>
			<view class="list_info_box" v-if="row.goods && row.goods.length > 0 && row.type != 5">
				<scroll-view scroll-x="true">
					<view class="list_info">
						<view class="list_info_row" v-for="(row2,i2) in row.goods.slice(0,6)" :key="i2" @click="onProductDetails(row2)">
							<view class="info_image">
								<image :src="row2.cover" mode="scaleToFill"  class="info_image"></image>
							</view>
							<!-- <view class="list_info_money" v-if='row2.tag && row2.tag.length > 0'>
								<view class="row" v-if='row2.amount_x'>
									<text>¥{{row2.amount_x.split('.')[0]}}.</text>
									<text>{{row2.amount_x.split('.')[1] ? row2.amount_x.split('.')[1] : '00'}}</text>
								</view>
								<view class="row" v-if='row2.amount_y'>
									<text>¥{{row2.amount_y.split('.')[0]}}.</text>
									<text>{{row2.amount_y.split('.')[1] ? row2.amount_y.split('.')[1] : '00'}}</text>
								</view>
							</view>
							<view class="info_center">
								{{row2.name}}
							</view>
							<view class="info_label" v-if='row2.tag && row2.tag.length > 0'>
								<text>{{row2.tag[0].length <= 10 ? row2.tag[0] : row2.tag[0].substring(0,9) + '..'}}</text>
								<text v-if='row2.tag.length >1 && row2.tag[0].length < 4 && row2.tag[1].length < 4'>{{row2.tag[1]}}</text>
								 <text v-for="(row3,i3) in row2.tag.slict(0,2)" :key="i3">{{row3}}</text> 
							 </view> --> 
						</view>
					</view>
				</scroll-view>
			</view>
			
			<view class="list_info_box" v-if="row.goodsauthorize && row.goodsauthorize.length > 0 && row.type == 5">
				<scroll-view scroll-x="true">
					<view class="list_info">
						<view class="list_info_row" v-for="(row2,i2) in row.goodsauthorize.slice(0,6)" :key="i2" @click="onProductDetails(row2)">
							<view class="info_image">
								<image :src="row2.cover" mode="scaleToFill"  class="info_image"></image>
							</view>
							<!-- <view class="list_info_money" v-if='row2.tag && row2.tag.length > 0'>
								<view class="row" v-if='row2.amount_x'>
									<text>¥{{row2.amount_x.split('.')[0]}}.</text>
									<text>{{row2.amount_x.split('.')[1] ? row2.amount_x.split('.')[1] : '00'}}</text>
								</view>
								<view class="row" v-if='row2.amount_y'>
									<text>¥{{row2.amount_y.split('.')[0]}}.</text>
									<text>{{row2.amount_y.split('.')[1] ? row2.amount_y.split('.')[1] : '00'}}</text>
								</view>
							</view>
							<view class="info_center">
								{{row2.name}}
							</view>
							<view class="info_label" v-if='row2.tag && row2.tag.length > 0'>
								<text>{{row2.tag[0].length <= 10 ? row2.tag[0] : row2.tag[0].substring(0,9) + '..'}}</text>
								<text v-if='row2.tag.length >1 && row2.tag[0].length < 4 && row2.tag[1].length < 4'>{{row2.tag[1]}}</text>
								 <text v-for="(row3,i3) in row2.tag.slict(0,2)" :key="i3">{{row3}}</text> 
							 </view> --> 
						</view>
					</view>
				</scroll-view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		props: {
			row: {
				type: Object,
				default: {}
			},
			status:{
				type:String,
				default:''
			},
			type:{
				type:String,
				default:''
			},
			source:{
				type:[String,Number],
				default:0
			},
			duihuan:{
				type:[Number,String],
				default:0
			},
			yunshop:{
				type:[Number,String],
				default:0
			},
			shouquan:{
				type:[Number,String],
				default:0
			},
			offer:{
				type:[Number,String],
				default:''
			}
		},
		data() {
			return {

			}
		},
		methods: {
			onShop(row){
				console.log(row, '传过来的数据');
				//新改动，所有角色都跳同一个页面
				// if(this.type == 'buildingMaterialsCity' ||　this.type == 'cloudFactory'){
				// 	// 跳转到店铺
				// 	uni.navigateTo({
				// 		url:`/pagesCommodity/shopDetailsBuilding?id=${row.id}&name=${encodeURIComponent(row.name)}&offer=${this.offer}&source=${this.source}&duihuan=${this.duihuan}&shouquan=${this.shouquan}&yunshop=${this.yunshop}`
				// 	})
				// }else{
					uni.navigateTo({
						url:`/pagesCommodity/shopDetailsDefault?type=${this.type}&id=${row.id}&name=${encodeURIComponent(row.name)}&source=${this.source}&offer=${this.offer}&duihuan=${this.duihuan}&shouquan=${this.shouquan}&yunshop=${this.yunshop}`
					})
				// }
			},
			onProductDetails(row){
				console.log(this.duihuan, '角色判断shangp');
				if(this.row.type == 5){
					var shopaid = this.row.id;
				}else{
					var shopaid = 0;
				}
				uni.navigateTo({
					url:`/pagesCommodity/information?id=${row.id}&type=${this.type}&source=${this.source}&offer=${this.offer}&duihuan=${this.duihuan}&shouquan=${this.shouquan}&shopaid=${shopaid}&yunshop=${this.yunshop}`
				})
			},
		},
		created() {

		}
	}
</script>

<style scoped lang="scss">
	.list_row {
		width: 100%;
		padding: 36rpx 0 30rpx 24rpx;
		box-sizing: border-box;
		// min-height: 520rpx;
		background: #ffffff;
		border-radius: 20rpx;
		margin-bottom: 40rpx;
		box-shadow: 0px 4rpx 12rpx 0px rgba(165, 165, 165, 0.20);

		.list_top {
			padding-right: 24rpx;
			width: 100%;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			
			.list_top_left {
				width: calc(100% - 125rpx);
				display: flex;
				justify-content: space-between;
				.image {
					width: 80rpx;
					height: 80rpx;
					border-radius: 50%;
					background-color: #C8C7CC;
					image{
						width: 80rpx;
						height: 80rpx;
						border-radius: 50%;
					}
				}

				.info {
					width: calc(100% - 104rpx);
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					>view:nth-child(1) {
						font-size: 28rpx;
						color: #26252B;
						line-height: 40rpx;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
					}

					>view:nth-child(2) {
						display: flex;
						align-items: center;

						text {
							color: #797979;
							font-size: 24rpx;
							line-height: 24rpx;
						}

						image {
							width: 28rpx;
							height: 28rpx;
							margin-right: 8rpx;
						}
					}
				}
			}

			.list_top_right {
				width: 108rpx;
				height: 48rpx;
				background: #ffffff;
				box-sizing: border-box;
				border: 1rpx solid #fe7a1f;
				border-radius: 25rpx;
				color: $theme;
				font-size: 26rpx;
				line-height: 46rpx;
				text-align: center;
			}
		}
	}

	.list_info_box {
		width: 100%;
		margin-top: 40rpx;
		height: 100%;
		.list_info {
			width: 100%;
			height: 100%;
			display: flex;
			// flex-wrap: nowrap;
		}

		.list_info_row {
			overflow: hidden;
			display: inline-flex;
			flex-direction: column;
			// align-items: center;
			min-width: 180rpx;
			margin-right: 28rpx;

			&:last-child {
				margin-right: 0;
			}

			.info_image {
				align-self: flex-start;
				background-color: #C8C7CC;
				width: 180rpx;
				height: 180rpx;
				border-radius: 20rpx;
				margin-bottom: 16rpx;
			}

			.list_info_money {
				width: 100%;
				text-align: left;
				.row{
					display: inline-block;
				}
				>view:nth-child(1) {
					font-size: 28rpx;
					line-height: 44rpx;
					color: #FE0200;
					>text:nth-child(2){
						font-size: 22rpx;
					}
				}

				>view:nth-child(2) {
					font-size: 22rpx;
					line-height: 44rpx;
					color: #ADADAD;
					margin-left: 16rpx;
					text-decoration: line-through;
					>text:nth-child(2){
						font-size: 20rpx;
					}
				}
				&:last-child{
					>view:nth-child(1) {
						font-size: 24rpx;
						>text:nth-child(2){
							font-size: 20rpx;
						}
					}
					>view:nth-child(2) {
						font-size: 20rpx;
					}
				}

			}

			.info_center {
				width: 180rpx;
				height:64rpx ;
				margin-top: 10rpx;
				font-size: 22rpx;
				line-height: 32rpx;
				text-align: left;
				color: #26252B;
				overflow: hidden;
				text-overflow: ellispsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}

			.info_label {
				min-width: 180rpx;
				text-align: left;
				>text {
					display: inline-block;
					margin-top: 16rpx;
					padding: 4rpx 8rpx;
					// height: 30rpx;
					line-height: 26rpx;
					background: #ffffff;
					border: 1px solid #fe0200;
					border-radius: 8rpx;
					margin-left: 12rpx;
					font-size: 18rpx;
					color: #FE0200;

					&:first-child {
						margin-left: 0rpx;
					}
				}
			}
		}
	}
</style>
